﻿using System.Windows.Input;
using Refract;
using Refract.Demo.Infrastructure.Commands;
using Microsoft.Practices.Unity;
using Refract.Views;
using Refract.Navigation;
using Microsoft.Practices.Composite.Presentation.Commands;

namespace Refract.Demo
{
    /// <summary>
    /// ViewModel for the shell
    /// </summary>
    public class ShellViewModel : ViewModel<Shell>
    {
        /// <summary>
        /// Gets or sets the navigation.
        /// </summary>
        /// <value>The navigation.</value>
        [Dependency]
        public INavigator Navigator { get; set; }

        /// <summary>
        /// Gets the pages.
        /// </summary>
        /// <value>The pages.</value>
        public PageItemList Pages { get { return Navigator.PageItems; } }
        public DelegateCommand<string> TestCommand { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ShellViewModel"/> class.
        /// </summary>
        public ShellViewModel() : base("Shell") { TestCommand = new DelegateCommand<string>(Test, p => { return true; }); }
        private void Test(string param)
        {
            Navigator.PageItems["Hello"].Active = !Navigator.PageItems["Hello"].Active;
        }
    }
}
